<?php
	/**
	* Video Cat Edit
	* @author: trungdt
	* @since: Oct 26, 2011
	* @version: 1.0
	* 
	* Change logs
	* 
	*/

	if (!defined("EXPONENT")) exit("");
	$video_cat = null;
	if (isset($_GET['id'])) {
		$video_cat = $db->selectObject("videomodule_cat","id=".intval($_GET['id']));
	}

	if (exponent_users_isAdmin() || exponent_permissions_check(array("administrate", "edit", "create", "delete"), $loc)) {
		
		// manual create form object
		if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();

		global $db;

		$form = new form();

		if (!isset($video_cat->id)) {
			$video_cat->title = '';
			$video_cat->search_des = '';
			$video_cat->seo_name = '';
		} else {
			$form->meta('id',$video_cat->id);
		}

		$form->register('title','Video Category name',new textcontrol($video_cat->title,50,false,100,"",true));
		$form->register('seo_name','Seo Name',new textcontrol($video_cat->seo_name,50,false,100,"",false));
		$form->register('search_des','Search Description',new texteditorcontrol($video_cat->search_des,3,50));

		$form->register('submit','',new buttongroupcontrol('Save','','Cancel'));

		$form->location($loc);
		$form->meta("action","video_cat_save");

		$template = new template("videomodule","_video_cat_edit",$loc);
		$template->assign("is_edit",(isset($video_cat->id) ? 1 : 0));
		$template->assign("form_html",$form->toHTML());
		$template->output();
	} else {
		echo exponent_http_error(403);
	}

?>